<?php
/**
 * Created by PhpStorm.
 * User: sunqiang
 * Date: 15-2-10
 * Time: 上午10:59
 */
//http://121.43.104.7:91/if/wx/token.php?action=mcake_wxapi_token_20150210

//接口暂时关闭
die('500');

if($_REQUEST['action'] == 'mcake_wxapi_token_20150210')
{
    $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxf346c8e83586af4c&secret=aa36ea3b65cc4265d759813259720384';
    echo  send_post($url,null);
}




/**
	 * 发送post请求
	 * @param string $url 请求地址
	 * @param array $post_data post键值对数据
	 * @return string
	 */
	function send_post($url, $post_data) {

	    $postdata = http_build_query($post_data);
	    $options = array(
        	    'http' => array(
        	    'method' =>'POST',
	            'header' => 'Content-type:application/x-www-form-urlencoded',
	            'content' => $postdata,
	            'timeout' => 15 * 60 // 超时时间（单位:s）
	        )
	    );
	    $context = stream_context_create($options);
	    $result = file_get_contents($url, false, $context);

	    return $result;
	}